package com.my.mvpframe.ui.task;

import com.my.mvpframe.R;
import com.my.mvpframe.base.app.BaseActivity;
import com.my.mvpframe.mvp.base.BasePresenter;
import com.my.mvpframe.utils.ActivityUtils;

import javax.inject.Inject;

import dagger.Lazy;

/**
 * Created by tomey on 2018/2/1.
 */

public class TaskActivity extends BaseActivity<TaskContract.View,TaskPresenter> {
    @Inject
    TaskPresenter presenter;
    @Inject
    Lazy<TaskFragment> taskFragmentProvider;



    @Override
    protected int getLayoutId() {
        return R.layout.activity_task;
    }

    @Override
    protected void initView() {
        TaskFragment tasksFragment = (TaskFragment) getSupportFragmentManager().findFragmentById(R.id.contentFrame);

        if (tasksFragment == null) {
            tasksFragment = taskFragmentProvider.get();
            ActivityUtils.addFragmentToActivity(getSupportFragmentManager(), tasksFragment, R.id.contentFrame);
        }
        presenter.showData();
    }

    @Override
    protected TaskPresenter initPresenter() {
        return presenter;
    }
}
